package com.magicsoft.share.presenter.my;

import com.magicsoft.share.base.BasePresenter;
import com.magicsoft.share.constant.APIService;
import com.magicsoft.share.constant.SPKey;
import com.magicsoft.share.rx_retrofit_network.location.retrofit.RetrofitUtil;
import com.magicsoft.share.rx_retrofit_network.location.rxandroid.LoadingTransformer;
import com.magicsoft.share.rx_retrofit_network.location.rxandroid.NetWorkTransformer;
import com.magicsoft.share.rx_retrofit_network.location.rxandroid.SimpleObserver;
import com.magicsoft.share.utils.SPUtils;
import com.magicsoft.share.view.my.IEditPersonalInfoView;

/**
 * Created by lyf on 2017/11/21/021.
 */

public class EditPersonalInfoPresenter extends BasePresenter<IEditPersonalInfoView> {


    public void editUserDetail(String nickName, String headimg, String personalizedSignature, String region, String birthday) {
        RetrofitUtil
                .getApi(APIService.class)
                .editUserDetail(SPUtils.getInstance().getString(SPKey.TOKEN), SPUtils.getInstance().getLong(SPKey.ID), null, null, nickName, headimg, personalizedSignature, region, birthday)
                .compose(new NetWorkTransformer())
                .compose(new LoadingTransformer(mContext))
                .subscribe(new SimpleObserver(mCompositeDisposable) {
                    @Override
                    public void call(Object o) {

                        getView().editUserDetailSuccess();
                    }
                });
    }
}
